﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Collections.Specialized;

namespace VehicleConfigurator.NetUtils.Settings
{
    public class AppConfig
    {
        public static class Constants
        {
            // Format
            public const String DEFAULT_DATE_FORMAT = "yyyy.MM.dd";
            public const String DEFAULT_DATETIME_FORMAT = "yyyy.MM.dd HH:mm";

            // Constant
            public const String TIMEZONE = "TIMEZONE";
            public const String DATETIME_FORMAT = "DATETIME_FORMAT";

            public const String AM_IMPORT_SETTINGS = ImportConfig.Constants.AM_IMPORT_SETTINGS;
            public const String AM_EXPORT_SETTINGS = ImportConfig.Constants.AM_EXPORT_SETTINGS;

            public const String AM_IMPORT_TRANSLATION = ImportConfig.Constants.AM_IMPORT_TRANSLATION;
            public const String AM_IMPORT_OPTION_PRICELIST = ImportConfig.Constants.AM_IMPORT_OPTION_PRICELIST;
            public const String AM_IMPORT_MODEL_PRICELIST = ImportConfig.Constants.AM_IMPORT_MODEL_PRICELIST;


        }

        public static class Pricing
        {
            public const String STANDARD = "S";
            public const String OPTIONAL = "O";
            public const String UNAVAILABLE = "-";
        }

        public static NameValueCollection GetCustomSettings(String section)
        {
            return ConfigurationManager.GetSection(section) as NameValueCollection;
        }

        public static NameValueCollection GetImportSettings(String sessionKey)
        {
            var section = String.Format("{0}/{1}", AppConfig.Constants.AM_IMPORT_SETTINGS, sessionKey);
            return GetCustomSettings(section);
        }
        public static NameValueCollection GetExportSettings(String sessionKey)
        {
            var section = String.Format("{0}/{1}", AppConfig.Constants.AM_EXPORT_SETTINGS, sessionKey);
            return GetCustomSettings(section);
        }
    }
}
